#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/async.h>
namespace bite {
std::shared_ptr<spdlog::logger> g_logger;
void init_logger(const std::string &logger_name, 
 const std::string &logger_file, 
 spdlog::level::level_enum logger_level) {
 spdlog::flush_on(logger_level);
 spdlog::init_thread_pool(32768, 1);
 if (logger_file == "stdout")
 g_logger = spdlog::stdout_color_mt(logger_name);
 else
 g_logger = 
spdlog::basic_logger_mt<spdlog::async_factory>(logger_name, 
logger_file);
 g_logger->set_pattern("%H:%M:%S [%n][%-7l]%v");
 g_logger->set_level(logger_level);
} 

#define DBG(format, ...) bite::g_logger-\
>debug(std::string("[{:>10s}:{:<4d}] ")+format, __FILE__,\
__LINE__, ##__VA_ARGS__);
#define INF(format, ...) bite::g_logger-\
>info(std::string("[{:>10s}:{:<4d}] ")+format, __FILE__, __LINE__, \
##__VA_ARGS__);
#define WRN(format, ...) bite::g_logger-\
>warn(std::string("[{:>10s}:{:<4d}] ")+format, __FILE__, __LINE__,\
##__VA_ARGS__);
#define ERR(format, ...) bite::g_logger-\
>error(std::string("[{:>10s}:{:<4d}] ")+format, __FILE__,\
__LINE__, ##__VA_ARGS__);
}